load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load(
    "../defs.bzl",
    "FBANDROID_CPPFLAGS",
    "folly_xplat_library",
)

oncall("fbcode_entropy_wardens_folly")

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "f14_hash",
    fbandroid_exported_preprocessor_flags = FBANDROID_CPPFLAGS,
    raw_headers = [
        "F14Map.h",
        "F14Set.h",
    ],
    exported_deps = [
        "//xplat/folly:traits",
        "//xplat/folly/container:f14_hash_fwd",
        "//xplat/folly/container:view",
        "//xplat/folly/container/detail:f14_hash_detail",
        "//xplat/folly/container/detail:util",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "heterogeneous_access",
    raw_headers = [
        "HeterogeneousAccess.h",
    ],
    deps = [
        "fbsource//xplat/folly/hash:hash",
        "fbsource//xplat/folly/hash:rapidhash",
        "//xplat/folly:portability",
        "//xplat/folly:range",
        "//xplat/folly:traits",
        "//xplat/folly/container:heterogeneous_access_fwd",
        "//xplat/folly/hash/detail:random_seed",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "heterogeneous_access_fwd",
    raw_headers = [
        "HeterogeneousAccess-fwd.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "enumerate",
    raw_headers = [
        "Enumerate.h",
    ],
    exported_deps = [
        "fbsource//xplat/folly/portability:sys_types",
        "//xplat/folly:c_portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "sparse_byte_set",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = [
        "SparseByteSet.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "merge",
    raw_headers = [
        "Merge.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "evicting_cache_map",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = [
        "EvictingCacheMap.h",
    ],
    exported_deps = [
        "//third-party/boost:boost",
        "//xplat/folly/container:f14_hash",
        "//xplat/folly/container:heterogeneous_access",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "weighted_evicting_cache_map",
    raw_headers = [
        "WeightedEvictingCacheMap.h",
    ],
    exported_deps = [
        ":evicting_cache_map",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "view",
    raw_headers = [
        "View.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly/functional:invoke",
        "//xplat/folly/lang:customization_point",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "foreach",
    raw_headers = [
        "Foreach.h",
        "Foreach-inl.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:preprocessor",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/container:access",
        "//xplat/folly/functional:invoke",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "f14_hash_fwd",
    raw_headers = [
        "F14Map-fwd.h",
        "F14Set-fwd.h",
    ],
    deps = [
        "//xplat/folly/container/detail:f14_defaults",
        "//xplat/folly/memory:memory_resource",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "iterator",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = [
        "Iterator.h",
    ],
    exported_deps = [
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/container:access",
        "//xplat/folly/functional:invoke",
        "//xplat/folly/lang:rvalue_reference_wrapper",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "bit_iterator",
    raw_headers = [
        "BitIterator.h",
    ],
    exported_deps = [
        "//third-party/boost:boost",
        "//xplat/folly:portability",
        "//xplat/folly/container/detail:bit_iterator_detail",
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "array",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = [
        "Array.h",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "heap_vector_types",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = [
        "heap_vector_types.h",
    ],
    exported_deps = [
        "fbsource//xplat/folly/portability:builtins",
        "//xplat/folly:range",
        "//xplat/folly:scope_guard",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/container:iterator",
        "//xplat/folly/functional:invoke",
        "//xplat/folly/lang:exception",
        "//xplat/folly/memory:memory_resource",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "access",
    raw_headers = [
        "Access.h",
    ],
    exported_deps = [
        "//xplat/folly/functional:invoke",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "intrusive_heap",
    raw_headers = [
        "IntrusiveHeap.h",
    ],
    exported_deps = [
        "//third-party/boost:boost",
        "//third-party/glog:glog",
        "//xplat/folly:portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "range_traits",
    raw_headers = ["range_traits.h"],
    exported_deps = [
        "//xplat/folly:traits",
        "//xplat/folly:utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "regex_match_cache",
    srcs = ["RegexMatchCache.cpp"],
    raw_headers = ["RegexMatchCache.h"],
    deps = [
        "fbsource//xplat/folly/portability:windows",
        "fbsource//xplat/folly/synchronization:atomic_util",
        "//third-party/boost:boost_regex",
        "//third-party/fmt:fmt",
        "//third-party/glog:glog",
        "//xplat/folly:map_util",
        "//xplat/folly:string",
    ],
    exported_deps = [
        ":f14_hash",
        ":reserve",
        "//xplat/folly:chrono",
        "//xplat/folly:fbstring",
        "//xplat/folly:function",
        "//xplat/folly/hash:unique_hash_key",
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "span",
    raw_headers = ["span.h"],
    exported_deps = [
        "fbsource//xplat/folly/portability:constexpr",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:portability",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/container:access",
        "//xplat/folly/container:iterator",
        "//xplat/folly/functional:invoke",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "tape",
    raw_headers = [
        "tape.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:range",
        "//xplat/folly/container:iterator",
        "//xplat/folly/container/detail:tape_detail",
        "//xplat/folly/memory:uninitialized_memory_hacks",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "reserve",
    raw_headers = [
        "Reserve.h",
    ],
    exported_deps = [
        "//xplat/folly:likely",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "sorted_vector_types",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = ["sorted_vector_types.h"],
    exported_deps = [
        "//xplat/folly:scope_guard",
        "//xplat/folly:small_vector",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/lang:access",
        "//xplat/folly/lang:exception",
        "//xplat/folly/memory:memory_resource",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "std_bitset",
    raw_headers = ["StdBitset.h"],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "fbvector",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = [
        "FBVector.h",
    ],
    exported_deps = [
        "//xplat/folly:format_traits",
        "//xplat/folly:likely",
        "//xplat/folly:scope_guard",
        "//xplat/folly:traits",
        "//xplat/folly/lang:checked_math",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:hint",
        "//xplat/folly/memory:malloc",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "intrusive_list",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = [
        "IntrusiveList.h",
    ],
    exported_deps = [
        "//third-party/boost:boost",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "map_util",
    raw_headers = [
        "MapUtil.h",
    ],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        "//xplat/folly:optional",
        "//xplat/folly:range",
        "//xplat/folly/functional:invoke",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "small_vector",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    raw_headers = [
        "small_vector.h",
    ],
    exported_deps = [
        "fbsource//xplat/folly/hash:hash",
        "fbsource//xplat/folly/portability:malloc",
        "//third-party/boost:boost",
        "//xplat/folly:constexpr_math",
        "//xplat/folly:format_traits",
        "//xplat/folly:likely",
        "//xplat/folly:portability",
        "//xplat/folly:scope_guard",
        "//xplat/folly:traits",
        "//xplat/folly/functional:invoke",
        "//xplat/folly/lang:align",
        "//xplat/folly/lang:assume",
        "//xplat/folly/lang:checked_math",
        "//xplat/folly/lang:exception",
        "//xplat/folly/memory:malloc",
        "//xplat/folly/memory:sanitize_leak",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "vector_bool",
    raw_headers = [
        "vector_bool.h",
    ],
    exported_deps = [
        "//xplat/folly/container/detail:bool_wrapper",
        "//xplat/folly/memory:memory_resource",
    ],
)

# !!!! fbcode/folly/container/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!!

fbcode_target(
    _kind = cpp_library,
    name = "access",
    headers = ["Access.h"],
    exported_deps = [
        "//folly/functional:invoke",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "array",
    headers = ["Array.h"],
    exported_deps = [
        "//folly:c_portability",
        "//folly:traits",
        "//folly:utility",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "bit_iterator",
    headers = ["BitIterator.h"],
    exported_deps = [
        "//folly:portability",
        "//folly/container/detail:bit_iterator_detail",
        "//folly/lang:bits",
    ],
    exported_external_deps = [
        "boost",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "iterator",
    headers = ["Iterator.h"],
    exported_deps = [
        ":access",
        "//folly:traits",
        "//folly:utility",
        "//folly/functional:invoke",
        "//folly/lang:rvalue_reference_wrapper",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "enumerate",
    headers = ["Enumerate.h"],
    exported_deps = [
        "//folly:c_portability",
        "//folly/portability:sys_types",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "evicting_cache_map",
    headers = ["EvictingCacheMap.h"],
    exported_deps = [
        "//folly/container:f14_hash",
        "//folly/container:heterogeneous_access",
        "//folly/lang:exception",
    ],
    exported_external_deps = [
        "boost",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "f14_hash",
    headers = [
        "F14Map.h",
        "F14Set.h",
    ],
    exported_deps = [
        ":f14_hash_fwd",
        ":iterator",
        ":view",
        "//folly:portability",
        "//folly:range",
        "//folly:traits",
        "//folly/container/detail:f14_hash_detail",
        "//folly/container/detail:util",
        "//folly/lang:exception",
        "//folly/lang:safe_assert",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "f14_hash_fwd",
    headers = [
        "F14Map-fwd.h",
        "F14Set-fwd.h",
    ],
    exported_deps = [
        "//folly/container/detail:f14_defaults",
        "//folly/memory:memory_resource",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "heap_vector_types",
    headers = [
        "heap_vector_types.h",
    ],
    exported_deps = [
        ":iterator",
        "//folly:range",
        "//folly:scope_guard",
        "//folly:small_vector",
        "//folly:traits",
        "//folly:utility",
        "//folly/functional:invoke",
        "//folly/lang:exception",
        "//folly/memory:memory_resource",
        "//folly/portability:builtins",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "foreach",
    headers = [
        "Foreach.h",
        "Foreach-inl.h",
    ],
    exported_deps = [
        ":access",
        "//folly:portability",
        "//folly:preprocessor",
        "//folly:traits",
        "//folly:utility",
        "//folly/functional:invoke",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "heterogeneous_access_fwd",
    headers = [
        "HeterogeneousAccess-fwd.h",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "heterogeneous_access",
    headers = [
        "HeterogeneousAccess.h",
    ],
    exported_deps = [
        ":heterogeneous_access_fwd",
        "//folly:range",
        "//folly:traits",
        "//folly/hash:hash",
        "//folly/hash:rapidhash",
        "//folly/hash/detail:random_seed",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "merge",
    headers = ["Merge.h"],
)

fbcode_target(
    _kind = cpp_library,
    name = "range_traits",
    headers = ["range_traits.h"],
    exported_deps = [
        "//folly:traits",
        "//folly:utility",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "regex_match_cache",
    srcs = ["RegexMatchCache.cpp"],
    headers = ["RegexMatchCache.h"],
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:map_util",
        "//folly:string",
        "//folly/portability:windows",
        "//folly/synchronization:atomic_util",
    ],
    exported_deps = [
        ":f14_hash",
        ":reserve",
        "//folly:chrono",
        "//folly:function",
        "//folly/hash:unique_hash_key",
        "//folly/lang:bits",
    ],
    external_deps = [
        "glog",
        ("boost", None, "boost_regex"),
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "span",
    headers = ["span.h"],
    exported_deps = [
        ":access",
        ":iterator",
        "//folly:cpp_attributes",
        "//folly:portability",
        "//folly:traits",
        "//folly:utility",
        "//folly/functional:invoke",
        "//folly/portability:constexpr",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "sparse_byte_set",
    headers = ["SparseByteSet.h"],
    exported_deps = [
        "//folly:c_portability",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "tape",
    headers = [
        "tape.h",
    ],
    exported_deps = [
        ":iterator",
        "//folly:portability",
        "//folly:range",
        "//folly/container/detail:tape_detail",
        "//folly/memory:uninitialized_memory_hacks",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "view",
    headers = ["View.h"],
    exported_deps = [
        "//folly:portability",
        "//folly/functional:invoke",
        "//folly/lang:customization_point",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "weighted_evicting_cache_map",
    headers = [
        "WeightedEvictingCacheMap.h",
    ],
    exported_deps = [
        "//folly/container:evicting_cache_map",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "intrusive_heap",
    headers = [
        "IntrusiveHeap.h",
    ],
    exported_deps = [
        "//folly:portability",
        "//folly/lang:builtin",
    ],
    exported_external_deps = [
        "boost",
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "reserve",
    headers = [
        "Reserve.h",
    ],
    exported_deps = [
        "//folly:likely",
        "//folly:traits",
        "//folly:utility",
        "//folly/lang:exception",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "sorted_vector_types",
    headers = [
        "sorted_vector_types.h",
    ],
    exported_deps = [
        "//folly:scope_guard",
        "//folly:small_vector",
        "//folly:traits",
        "//folly:utility",
        "//folly/lang:access",
        "//folly/lang:exception",
        "//folly/memory:memory_resource",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "std_bitset",
    headers = ["StdBitset.h"],
    exported_deps = [
        "//folly:c_portability",
        "//folly:portability",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "fbvector",
    headers = ["FBVector.h"],
    exported_deps = [
        "//folly:format_traits",
        "//folly:likely",
        "//folly:scope_guard",
        "//folly:traits",
        "//folly/lang:checked_math",
        "//folly/lang:exception",
        "//folly/lang:hint",
        "//folly/memory:malloc",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "intrusive_list",
    headers = ["IntrusiveList.h"],
    exported_external_deps = [
        "boost",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "map_util",
    headers = ["MapUtil.h"],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:optional",
        "//folly:range",
        "//folly/functional:invoke",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "small_vector",
    headers = ["small_vector.h"],
    exported_deps = [
        "//folly:constexpr_math",
        "//folly:format_traits",
        "//folly:likely",
        "//folly:portability",
        "//folly:scope_guard",
        "//folly:traits",
        "//folly/functional:invoke",
        "//folly/hash:hash",
        "//folly/lang:align",
        "//folly/lang:assume",
        "//folly/lang:checked_math",
        "//folly/lang:exception",
        "//folly/memory:malloc",
        "//folly/memory:sanitize_leak",
        "//folly/portability:malloc",
    ],
    exported_external_deps = [
        "boost",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "vector_bool",
    headers = ["vector_bool.h"],
    exported_deps = [
        "//folly/container/detail:bool_wrapper",
        "//folly/memory:memory_resource",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "collection_util",
    headers = ["CollectionUtil.h"],
)

fbcode_target(
    _kind = cpp_library,
    name = "irange",
    headers = ["irange.h"],
    deps = [],
    exported_deps = [],
)
